<!--
  @author yangjiangming
  @date 2018/11/26 10:00
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<div th:fragment="redistribute-table">
    <table class="layui-table" lay-data="{ data: [] }" id="zmn-work-table" lay-filter="zmn-work-table">
        <thead>
        <tr>
            <th lay-data="{ title: '警示', width: 120, align: 'center', templet: '#warnings'}">警示</th>
            <th lay-data="{ field: 'createTime', title: '发起时间', width: 180, align: 'left', sort: true}">发起时间</th>
            <th lay-data="{ field: 'applyUser', title: '发起人', width: 80, align: 'center', sort: true}">发起人</th>
            <th lay-data="{ field: 'reason', title: '改派缘由', width: 200, align: 'left'}">改派缘由</th>
            <th lay-data="{ field: 'workId', title: '工单号', width: 160, align: 'left'}">工单号</th>
            <th lay-data="{ field: 'countEnable', title: '计入轮次', width: 80, align: 'center', templet: '#countEnableTemplate'}"></th>
            <th lay-data="{ field: 'statusName', title: '工单状态', width: 80, align: 'center', templet: '#statusTemplate'}"></th>
            <th lay-data="{ field: 'helpStatusName', title: '求助状态', width: 80, align: 'center'}">求助状态</th>
            <th lay-data="{ field: 'auditStatusName', title: '审核状态', width: 80, align: 'center', sort: true}">审核状态</th>
            <th lay-data="{ field: 'redistributeStatusName', title: '改派状态', width: 80, align: 'center'}">改派状态</th>
            <th lay-data="{ field: 'spuriousStatus', title: '虚假改派', width: 80, align: 'center', templet: '#spuriousStatusTemplate'}"></th>
            <th lay-data="{ field: 'companyName', title: '子公司', width: 80, align: 'center'}">子公司</th>
            <th lay-data="{ field: 'redistributeMasterName', title: '主工程师', width: 80, align: 'center'}">主工程师</th>
            <th lay-data="{ title: '审核人', width: 100, align: 'center', templet: '#auditerTemplate'}">审核人</th>
            <th lay-data="{ field: 'lastRemark', title: '备注', align: 'left'}">备注</th>
            <th lay-data="{ field: 'operation', title: '操作', align: 'center', width: 115, fixed: 'right', templet: '#btn-operate'}"></th>
        </tr>
        </thead>
    </table>

    <script type="text/html" id="btn-operate">
        <div style="text-align:right">
            <!-- 满足以下条件时，才会展示出审核按钮：
                        【审核状态】：待审核 或 进行中
                        【审核类型】：员工审核
                        【改派状态】：待改派 -->
            {{# if ((d.auditStatus == 1 || d.auditStatus == 5) && d.auditType == 2 && d.redistributeStatus == 1) { }}
            <a class="layui-btn layui-btn-sm" lay-event="audit">审核</a>
            {{# } }}
            <a class="layui-btn layui-btn-sm" lay-event="detail">详情</a>
        </div>
    </script>

    <script type="text/html" id="warnings">
        {{ templates.formatWarning(d) }}
    </script>

    <!-- 工单状态 -->
    <script type="text/html" id="statusTemplate">
        {{ templates.resultStatusFormatterFactory('status')(d) }}
    </script>

    <!-- 计入轮次 1.否 2.是 -->
    <script type="text/html" id="countEnableTemplate">
        <div>
            {{# if ((d.countEnable != "" && d.countEnable != null) && d.countEnable == 1) { }}
            <span>否</span>
            {{# } }}
            {{# if ((d.countEnable != "" && d.countEnable != null) && d.countEnable == 2) { }}
            <span>是</span>
            {{# } }}
        </div>
    </script>

    <!-- 当审核人不为空时，才会显示虚假改派 1.否 2.是 -->
    <script type="text/html" id="spuriousStatusTemplate">
        <div>
            {{# if ( (d.auditer != "" && d.auditer != null) && d.spuriousStatus == 1) { }}
            <span>否</span>
            {{# } }}
            {{# if ( (d.auditer != "" && d.auditer != null) && d.spuriousStatus == 2) { }}
            <span>是</span>
            {{# } }}
        </div>
    </script>

    <!-- 审核类型 0无 1主管审核 2员工审核 -->
    <script type="text/html" id="auditerTemplate">
        <div>
            {{ d.auditer }}
            {{# if ((d.auditer != "" && d.auditer != null) && d.auditerType == 1) { }}
            <span>(主管)</span>
            {{# } }}
            {{# if ((d.auditer != "" && d.auditer != null) && d.auditerType == 2) { }}
            <span>(员工)</span>
            {{# } }}
        </div>
    </script>

</div>

<!--操作记录-->
<section id="zmn-table" lay-filter="zmn-table" th:fragment="logTable">
    <div>
        <div class="layui-row">
            <div class="layui-tab layui-tab-card" lay-filter="tabChange" id="log-tab">
                <ul class="layui-tab-title">
                    <li class="layui-this">全部</li>
                    <li class="call-log">通话记录</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th width="130" style="text-align: center;">操作时间</th>
                                <th width="130" style="text-align: center;">操作</th>
                                <th>操作内容</th>
                                <th width="150" style="text-align: center;">操作员</th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr th:each="item:${infoVo?.logList}">
                                <td th:text="${(item.createTime==null?'':#dates.format(item.createTime, 'yyyy-MM-dd HH:mm:ss'))}"></td>
                                <td th:text="${item.typeName}"></td>
                                <td style="text-align: left;" th:utext="${#stringUtil.replaceToBr(item.content)}"></td>
                                <td th:text="${item.operator}"></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>


<div id="spurious-standard" th:fragment="spurious-standard">
    <div style="margin-top: 10px;padding: 10px;text-align: center;">工程师发起的改派缘由，与实际的核实的情况不一致，算：虚假</div>
    <table class="layui-hide" id="zmn-table-spurious-standard" lay-filter="zmn-table-spurious-standard">
        <thead>
        <tr>
            <th lay-data="{field:'id', width:80, unresize:false, align:'center'}">编号</th>
            <th lay-data="{field:'typeName', width:300, unresize:false, align:'center'}">场景</th>
            <th lay-data="{field:'content', width:450, unresize:false, align:'center'}">虚假定义</th>
        </tr>
        </thead>

        <tbody>
        <tr>
            <td>1</td>
            <td>用户要求尽快上门但工程师时间冲突</td>
            <td>用户未要求尽快上门，或者与工程师上门时间并不冲突时，算虚假</td>
        </tr>
        <tr>
            <td>2</td>
            <td>技术原因</td>
            <td>工程师未上门，算虚假</td>
        </tr>
        <tr>
            <td>3</td>
            <td>订单品类或地址错误</td>
            <td>订单服务品类或地址，与用户的需求或地址吻合时，算虚假</td>
        </tr>
        <tr>
            <td>4</td>
            <td>与工程师技能不符</td>
            <td>订单服务品类与工程师技能符合时，算虚假</td>
        </tr>
        <tr>
            <td>5</td>
            <td>意外受伤、车辆或工具损坏</td>
            <td></td>
        </tr>
        <tr>
            <td>6</td>
            <td>疫情改派</td>
            <td></td>
        </tr>
        </tbody>
    </table>
</div>